package com.jack006.api.service;

import com.github.pagehelper.PageInfo;
import com.jack006.utils.PagedGridResult;
import com.jack006.utils.RedisOperator;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Classname BaseService
 * @Description 接口父类
 * @Date 2021-07-03 16:06
 * @Created by jack
 */
public class BaseService {

    public static final String REDIS_ALL_CATEGORY = "redis_all_category";
    public static final String REDIS_WRITER_FANS_COUNTS = "redis_writer_fans_counts";
    public static final String REDIS_MY_FOLLOW_COUNTS = "redis_my_follow_counts";
    public static final String REDIS_ARTICLE_COMMENTS_COUNTS = "redis_article_comments_counts";


    @Autowired
    public RedisOperator redisOperator;


    public PagedGridResult setterPagedGrid(List<?> adminUserList,
                                            Integer page) {
        PageInfo<?> pageList = new PageInfo<>(adminUserList);
        PagedGridResult gridResult = new PagedGridResult();
        gridResult.setRows(adminUserList);
        gridResult.setPage(page);
        gridResult.setRecords(pageList.getTotal());
        gridResult.setTotal(pageList.getPages());
        return gridResult;
    }


    public static void main(String[] args) {
        String s = "00C9CCC4";
        float v =  Float.parseFloat(s);
        System.out.println(v);


    }
}
